Skip to content

fix(desktop): skip view transitions on Linux WebKit (#3931) - #4276

Closed
iroiro147 wants to merge 2 commits into
block:mainfrom
iroiro147:fix/3931-linux-view-transition-hang
Closed

fix(desktop): skip view transitions on Linux WebKit (#3931)#4276
iroiro147 wants to merge 2 commits into
block:mainfrom
iroiro147:fix/3931-linux-view-transition-hang

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

What

Buzz hangs on Linux Mint (AppImage / webkitgtk) when the user removes the active community. The user reports having to force-quit the app. Windows does not hit the same codepath.

Root cause. runCommunityViewTransition calls document.startViewTransition(update). The transition's updateCallbackDone promise never settles on webkitgtk when the update destroys the currently painted frame mid-transition: WebKit invalidates the transition scene and the promise hangs forever. The 5s targetReady timeout does fire and the update itself completes (community is removed, fallback mounts), but the view-transition promise is stuck — so runCommunityViewTransition never returns to its caller and subsequent navigation stays broken until the process is killed.

Fix. The view transition is purely cosmetic. We already bypass it whenever document.startViewTransition is unavailable; this PR extends that branch to Linux as well, detected via the existing isLinuxPlatform() helper in desktop/src/shared/lib/platform.ts. On Linux the update runs to completion immediately and the app never enters the WebKit path that hangs. Behavior on Windows and macOS is unchanged.

Repro

From the reporter: Linux Mint + Buzz v0.5.2 AppImage → open a hosted community → Community Settings → Remove Community → window freezes.

Changes

  • desktop/src/app/communityViewTransition.ts: import isLinuxPlatform, OR it into the unsupported-browser branch so the update runs directly.
  • desktop/src/app/communityViewTransition.test.mjs: new test stubs globalThis.navigator as Linux, asserts startViewTransition is never called and the update still runs.

Tests

  • desktop/node --import ./test-loader.mjs --experimental-strip-types --test "src/app/communityViewTransition.test.mjs" → 7/7
  • Full webview suite: 3911/3911
  • pnpm exec tsc --noEmit clean

Fixes #3931

Signed-off-by: Sarthak Singh sarthak.singh@juspay.in

When a managed agent's underlying LLM call returns 401/403, buzz-agent
classifies it as JSON-RPC -32001 and the desktop previously rewrote that
to "Community access denied this agent — check its community membership."
for every agent, regardless of provider. That misleads the "Local
OpenAI-compatible" lane where the 401 came from the user's own upstream
(e.g. llama.cpp started with `--api-key`): the reporter's actual fix is
"your configured key doesn't match the server's", but the rewritten copy
points them at community membership — an unrelated codepath (see block#4205).

`friendlyAgentLastError` and `friendlyTurnErrorCopy` now accept the
agent's configured LLM provider and only substitute the mesh copy when
`provider === "relay-mesh"`; all other providers keep the raw error
verbatim. The legacy string fallback for pre-code records (`"llm auth:"`
prefix) gets the same gate so the conservative behavior is consistent.

Callers in ManagedAgentRow and UnifiedAgentsSection thread
`agent.provider` through. Tests mirror the reporter's lane (non-mesh +
-32001 → preserved) and the mesh case stays regression-tested.

http://github.com/block/buzz/issues/4205

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
Buzz hangs on Linux Mint (AppImage / webkitgtk) when the user removes the
active community: `document.startViewTransition` opens a transition whose
`updateCallbackDone` promise never settles on webkitgtk because destroying
the currently painted frame mid-transition invalidates the view-transition
scene and WebKit never resumes the callback promise. The user sees a frozen
window and has to SIGKILL the app. Windows does not hit the same codepath
because the frame lifecycle is different.

The view transition is purely cosmetic; the other branch already runs the
update directly when `document.startViewTransition` is unavailable. Extend
that branch to Linux as well: detect Linux via `isLinuxPlatform()` and
skip the transition entirely. The update still runs, relay switches, the
new community mounts — Linux users just see an instant swap instead of a
cross-fade, exactly as the unsupported-browser path delivers.

Repro from the reporter: Linux Mint + Buzz v0.5.2 AppImage → open a hosted
community → Community Settings → Remove Community → window freezes.

Includes a unit test that stubs the navigator as Linux and asserts
`startViewTransition` is never invoked while the update still runs.

Fixes block#3931

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
@oso0x34

oso0x34 commented Aug 13, 2026

Copy link
Copy Markdown

We independently arrived at the same guard while chasing the #3488 / #4142 segfault — different symptom, same call site. Evidence and the env-var matrix are in #3488 (comment). So: +1 on skipping view transitions on Linux WebKit.

One heads-up on the implementation, in case it's why this has been sitting: isLinuxPlatform() reads navigator.platform, and Node ≥ 21 defines navigator.platform === "Linux x86_64" in the plain Node test runner on Linux. With this branch, the three existing transition-path tests in communityViewTransition.test.mjs take the fallback branch and fail on any Linux dev box or CI runner — they pass on macOS, which can hide it locally.

A UA-based check (Linux + AppleWebKitChrome) targets WebKitGTK without tripping Node or Chromium dev sessions. That's the shape used in #5768, which also carries the crash evidence.

Happy either way — I can help get this PR green instead (it'd also want the unrelated friendlyAgentLastError / agent-UI changes split out), or maintainers can take whichever they prefer. The goal is just to stop the Linux crashes.

@iroiro147

Copy link
Copy Markdown
Contributor Author

@oso0x34 this is an excellent catch on both counts, and I verified rather than took it on faith: navigator.platform is indeed defined in the plain Node runner on Node ≥ 21, so this branch's platform check would flip the three transition-path tests onto the fallback branch on any Linux box — passing on macOS and hiding it locally, exactly as you said. And you're right that the friendlyAgentLastError / agent-UI changes don't belong in the same PR as the transition guard.

Your #5768 is the better home for this fix: the UA-based check (Linux + AppleWebKitChrome) targets WebKitGTK without tripping Node or Chromium dev sessions, it's scoped to just the two transition files, and it carries the #3488/#4142 crash evidence. So I'm closing this one in its favour — no point making maintainers read the same conditional twice, and yours is the stronger version.

If maintainers want the friendlyAgentLastError half, I'll resubmit it as its own scoped PR.

For maintainers: #5768 supersedes the view-transition half of this PR and is the one worth review time.

@iroiro147 iroiro147 closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buzz crashes when deleting community on Linux

2 participants